package com.endurance.controller;

import com.endurance.handler.factory.HandlerFactory;
import com.endurance.handler.impl.CurrentLimitHandler;
import com.endurance.service.HandlerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: sunlin
 * @Date: 2024-05-04 12:56
 * @Version: 1.0
 * @Description:
 */
@RestController
public class HandlerController {

    @Autowired
    private HandlerService handlerService;

    @RequestMapping("/handler")
    public String toPay() {
        // 1. 基础的方式实现
//        CurrentLimitHandler firstGatewayHandler = HandlerFactory.getFirstGatewayHandler();
//        firstGatewayHandler.service();
        // 使用数据库的方式实现
        handlerService.getDbFirstGatewayHandler().service();
        return "success";
    }

}
